﻿angular.module('app')
    .controller('SketchCtrl', ['$scope', '$rootScope', '$timeout', '$stateParams', function ($scope, $rootScope, $timeout, $stateParams) {
        jQuery("#sketchcontent").html('');
        //$rootScope.$broadcast('hidePreloading');

        $timeout(function () {
            $rootScope.$broadcast('hidePreloading');
        }, 500);

        var iframeUrl = 'sketch';
        if ($stateParams.workflow != null) {
            iframeUrl += "?workflow=" + $stateParams.workflow;
        }
        jQuery('<iframe src="' + iframeUrl + '" style="width:100%;border:none;height:720px;" border="0" id="sketchiframe"></iframe>').appendTo(jQuery("#sketchcontent")).load(function () {
            $timeout(function () {
                //var height = 750;
                //jQuery("#sketchiframe").css("height", height + "px");
                $timeout(function () {
                    $rootScope.$broadcast('hidePreloading');
                }, 500);
            }, 500);
        });
    }
]);